/**
 * 产品图片旋转
 * @author yaohuan
 * @date 2018/02/27
 */
define(function () {

    var self,
        app = win.app,
        doc = document,
        vueData = {
            url: '',
            current: 0
        },
        callObj
    ;

    var Img = app.Module.extend({
            init: function () {
                self = this;
                self._super({
                    _tag: 'gwai500_img'
                }, win);

            },

            _call: function (obj) {
                vueData.url = obj;
                vueData.current = 0;
                var img = document.getElementById('target');
                img.style.transform = 'rotate('+vueData.current+'deg)';
            },
            _ready: function () {
                var vue = new Vue({
                    el: '#gwai500_img',
                    data: vueData,
                    methods: {
                        tranform1: function () { //左旋转
                            var img = document.getElementById('target');
                            var width = img.width;
                            var height = img.height;
                            vueData.current = (vueData.current+90)%360;
                            img.style.transform = 'rotate('+vueData.current+'deg)';
                            // img.width = height;
                            // img.height = width;
                        },
                        tranform2: function () {//右旋转
                            var img = document.getElementById('target');
                            var width = img.width;
                            var height = img.height;
                            vueData.current = (vueData.current-90)%360;
                            img.style.transform = 'rotate('+vueData.current+'deg)';
                            // img.width = height;
                            // img.height = width;
                        }
                    },
                    watch: {}
                    ,
                    created: function () {
                        self._setEleIsReady('gwai500_img');
                    }
                });
            },
            _lazy: function () {
                this._super();
            }
        })
    ;

    return new Img();

})
;